package com.oneclick.tools.applock.bean;

public class PackageInfo implements Comparable<PackageInfo> {

	private long id;
	private String label;
	private String packageName;

	public PackageInfo() {
		super();
	}

	public PackageInfo(String label, String packageName) {
		super();
		this.label = label;
		this.packageName = packageName;
	}

	public PackageInfo(long id, String label, String packageName) {
		super();
		this.id = id;
		this.label = label;
		this.packageName = packageName;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	@Override
	public int compareTo(PackageInfo another) {
		return this.label.charAt(0) - another.getLabel().charAt(0);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((packageName == null) ? 0 : packageName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PackageInfo other = (PackageInfo) obj;
		if (packageName == null) {
			if (other.packageName != null)
				return false;
		} else if (!packageName.equals(other.packageName))
			return false;
		return true;
	}

}
